'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    ctx.body = 'hi, egg';
  }

  async banner() {
    const { ctx } = this;
    const banners = await ctx.service.home.banners();
    ctx.body = {
      code: 1,
      data: banners,
    };
  }

  async menu() {
    const { ctx } = this;
    const meuns = await ctx.service.home.menus();
    ctx.body = {
      code: 1,
      data: meuns,
    };
  }

  async nav() {
    const { ctx } = this;
    const navs = await ctx.service.home.navs();
    ctx.body = {
      code: 1,
      data: navs,
    };
  }
}

module.exports = HomeController;
